package com.automannn.springboot.practice.bootstrapContext;

import org.springframework.boot.BootstrapRegistry;
import org.springframework.boot.DefaultBootstrapContext;


/**
 * @author chenkh
 * @time 2021/10/8
 */
public class BootstrapContextTest {
    public static void main(String[] args) {
        DefaultBootstrapContext bootstrapContext  = new DefaultBootstrapContext();
        MyBean myBean= new MyBean();
        myBean.setName("theBean");
        bootstrapContext.register(MyBean.class, BootstrapRegistry.InstanceSupplier.of(myBean));
       MyBean myBean1=  bootstrapContext.get(MyBean.class);
        System.out.println(myBean1);
    }

    public static class MyBean{
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return "MyBean{" +
                    "name='" + name + '\'' +
                    '}';
        }
    }
}
